/*
 * @lc app=leetcode.cn id=1252 lang=typescript
 *
 * [1252] 奇数值单元格的数目
 */

// @lc code=start
function oddCells(m: number, n: number, indices: number[][]): number {
    const matrix: number[][] = new Array(m)
        .fill(0)
        .map((i) => Array(n).fill(0));
    indices.forEach(([y, x]) => {
        matrix[y] = matrix[y].map((i) => i + 1);
        matrix.forEach((row) => {
            row[x] = row[x] + 1;
        });
    });
    return matrix.reduce((col, cur) => {
        return cur.reduce((a, b) => {
            return a + (b % 2);
        }, col);
    }, 0);
}
// @lc code=end
